package com.nq.service;

import com.github.pagehelper.PageInfo;
import com.nq.common.ServerResponse;
import com.nq.pojo.User;
import com.nq.pojo.UserPosition;
import com.nq.pojo.UserRecharge;
import com.nq.pojo.vo.StFundDetailsVo;
import com.nq.pojo.vo.StPositionDetailsVo;
import com.nq.vo.position.PositionProfitVO;
import com.nq.vo.position.PositionVO;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import javax.servlet.http.HttpServletRequest;

public interface IUserPositionService {

  ServerResponse isBuyUp(String stockCode, String market, HttpServletRequest paramHttpServletRequest);


  ServerResponse buy(String stockCode, String market, Integer paramInteger2, Integer paramInteger3, Integer paramInteger4,BigDecimal paramInteger5,BigDecimal paramInteger6, HttpServletRequest paramHttpServletRequest, String payPwd) throws Exception;

  ServerResponse upBuy(String stockCode, String market, Integer paramInteger2, Integer paramInteger3, Integer paramInteger4,BigDecimal paramInteger5, BigDecimal paramInteger6, String paramInteger7, HttpServletRequest paramHttpServletRequest, String payPwd) throws Exception;

  ServerResponse dzBuy(Integer id, String password, Integer buyNum, HttpServletRequest paramHttpServletRequest, String payPwd) ;

  ServerResponse sell(String paramString, int paramInt) throws Exception;

  ServerResponse sellNew(String paramString, String market, int paramInt,  String payPwd, Integer userId) throws Exception;

  ServerResponse createSellout(Integer userId, String market, String stockId, Integer sellNum) throws Exception;

  ServerResponse lock(Integer paramInteger1, Integer paramInteger2, String paramString);
  
  ServerResponse del(Integer paramInteger);
  
  ServerResponse<PageInfo> findMyPositionByCodeAndSpell(String paramString1, String paramString2, Integer paramInteger, HttpServletRequest paramHttpServletRequest, int paramInt1, int paramInt2);
  
  PositionVO findUserPositionAllProfitAndLose(Integer paramInteger);
  
  List<UserPosition> findPositionByUserIdAndSellIdIsNull(Integer paramInteger);
  
  List<UserPosition> findPositionByStockCodeAndTimes(int paramInt, String paramString, Integer paramInteger);
  
  Integer findPositionNumByTimes(int paramInt, Integer paramInteger);
  
  ServerResponse listByAgent(String stockCode, Integer paramInteger1, Integer paramInteger2,
                             Integer paramInteger3, Integer paramInteger4,
                             String paramString1, String userPhone, String paramString2,
                             String paramString3, HttpServletRequest paramHttpServletRequest,
                             int paramInt1, int paramInt2);
  
  ServerResponse getIncome(String stockCode, Integer paramInteger1, Integer paramInteger2, String userPhone, String paramString1, String paramString2);
  

  
  int CountPositionNum(Integer paramInteger1, Integer paramInteger2);
  
  BigDecimal CountPositionProfitAndLose();
  
  BigDecimal CountPositionAllProfitAndLose();
  
  ServerResponse create(Integer paramInteger1, String paramString1, String market, String paramString2, String paramString3, Integer paramInteger2, Integer paramInteger3, Integer paramInteger4,BigDecimal paramInteger5,BigDecimal paramInteger6) ;
  
  int deleteByUserId(Integer paramInteger);
  
  void doClosingStayTask();
  void expireStayUnwindTask();
  
  ServerResponse closingStayTask(UserPosition paramUserPosition, Integer paramInteger) throws Exception;
  
  List<Integer> findDistinctUserIdList();

  ServerResponse<PageInfo> findPositionTopList(Integer pageSize);

  ServerResponse findUserPositionByCode(HttpServletRequest paramHttpServletRequest, String stockCode);

  ServerResponse getHoldNumById(HttpServletRequest httpServletRequest, String stockCode);

  ServerResponse listPositionDetail(Integer pageNum, Integer pageSize, HttpServletRequest httpServletRequest);

  ServerResponse addmargin(String paramString, int paramInt, BigDecimal marginAdd) throws Exception;

  PositionProfitVO getPositionProfitVO(UserPosition position);


  ServerResponse newStockToPosition(Integer id, String newCode);

  ServerResponse updateProfitTarget(String positionSn, Integer profitTarget, Integer stopTarget, HttpServletRequest request);

  /**
   * 是否有资金购买
   * @param user
   * @param buyAmount
   * @return
   */
  boolean updateUserAccount(User user, BigDecimal buyAmount);

  ServerResponse buyDz(String stockCode, String password, Integer num, HttpServletRequest request) throws Exception;

  ServerResponse buyStockDzList( HttpServletRequest request);


   ServerResponse buyVipQc(String stockCode,Integer buyNum, Integer buyType, Integer lever, BigDecimal profitTarget, BigDecimal stopTarget, HttpServletRequest request) throws Exception;

  ServerResponse queryPositionDetails(String phone, Integer userId, String positionNo, String startAmount, int pageNum, int pageSize);

  ServerResponse updateDetails(StPositionDetailsVo vo);

  ServerResponse editFundDetails(StFundDetailsVo vo);

  ServerResponse queryFundApplyDetails(String phone, Integer userId, String orderNumber, String startAmount, int pageNum, int pageSize);


  ServerResponse listByAdmin(Integer agentId, Integer positionType, Integer state, Integer userId, String stockCode, String positionSn, String userPhone, String beginTime, String endTime, int pageNum, int pageSize);
}
